OPC Studio User's Guide and Reference
Type-safe Access to OPC-DA Items and Properties
Concepts > OPC Data Client Concepts > OPC Data Client Extensions > OPC Data Client Layered Extensions for .NET and Python > OPC Data Access Extensions > Type-safe Access to OPC-DA Items and Properties
In This Topic

Type-safe Access to OPC-DA Items

With EasyOPC.NET Extensions, you can use type-safe methods that allow reading an item value already converted to the specified type, with methods such as EasyDAClient.ReadItemValueInt32. There is such a method for each primitive type, named ReadItemValueXXXX, where XXXX is the name of the type. Using these methods allows your code be free of unnecessary conversions. The methods also take care of passing a proper requested data type to the OPC server.

A corresponding set of methods also exists for one-dimensional arrays of primitive types. Such methods are named ReadItemValueArrayOfXXXX, where XXXX is the name of the element type. For example, EasyDAClient.ReadItemValueArrayOfInt32 will read from an item as an array of 32-bit signed integers.

You can also use type-safe methods that allow writing an item value of a specified type, with methods such as EasyDAClient.WriteItemValueInt32. There is such a method for each primitive type, named WriteItemValueXXXX, where XXXX is the name of the type. Using these methods allows your code be free of unnecessary conversions. The methods also take care of passing a proper requested data type to the OPC server.

A corresponding set of methods also exists for one-dimensional arrays of primitive types. Such methods are named WriteItemValueArrayOfXXXX, where XXXX is the name of the element type. For example, EasyDAClient.WriteItemValueArrayOfInt32 will write into an item as an array of 32-bit signed integers.

Type-safe Access to OPC-DA Properties

With EasyOPC.NET Extensions, you can use type-safe methods that allow obtaining a value of an OPC property value already converted to the specified type, with methods such as EasyDAClient.GetPropertyValueInt32. There is such a method for each primitive type, named GetPropertyValueXXXX, where XXXX is the name of the type. Using these methods allows your code be free of unnecessary conversions.

A corresponding set of methods also exists for one-dimensional arrays of primitive types. Such methods are named GetPropertyValueArrayOfXXXX, where XXXX is the name of the element type. For example, EasyDAClient.GetPropertyValueArrayOfString will obtain a value of a property as an array of strings.

See Also